package trb.complexshield.bool;

import no.hrp.hvrc.rad.calc.intersect.Segment;

public class SubtractSegments implements SegmentsProducer {

    private final SegmentsProducer a;
    private final SegmentsProducer b;

    public SubtractSegments(SegmentsProducer a, SegmentsProducer b) {
        this.a = a;
        this.b = b;
    }

    @Override
    public Segments getSegments(Segment line, Segments out, SegmentsMemory memory) {
        Segments.subtract(a.getSegments(line, memory.newSegments(), memory)
                , b.getSegments(line, memory.newSegments(), memory), out);
        return out;
    }
}
